<?php

defined('_JEXEC') or die('Restricted access'); ?>

<div>
<form action="index.php" method="post" name="adminForm">

	<table class="adminform">
		<tr>
			<td width="100%">
			  	<?php echo JText::_( 'SEARCH' ); ?>
				<input type="text" name="search" id="search" value="<?php echo $this->lists['search']; ?>" class="text_area" onChange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
				<button onclick="this.form.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['state']; ?>
			</td>
		</tr>
	</table>

	<table class="adminlist" cellspacing="1">
	<thead>
		<tr>
			<th width="5"><?php echo JText::_( 'Num' ); ?></th>
			<th width="5"><input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $this->rows ); ?>);" /></th>
			<th class="title"><?php echo JHTML::_('grid.sort', 'TITLE', 'p.title', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="20%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', JText::_( 'FROM' ), 'p.lat', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="20%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', JText::_( 'TO' ), 'p.long', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
                        <th width="5%" nowrap="nowrap"><?php echo JText::_( 'ROUTE_PRICE' ); ?></th>
                        <th width="5%" nowrap="nowrap"><?php echo JText::_( 'STATE' ); ?></th>
			<th width="80"><?php echo JHTML::_('grid.sort', 'REORDER', 'p.ordering', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="1%"><?php echo JHTML::_('grid.order', $this->rows, 'filesave.png', 'saveorder' ); ?></th>
			<th width="1%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'ID', 'p.id', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
		</tr>
	</thead>

	<tfoot>
		<tr>
			<td colspan="10">
				<?php echo $this->pageNav->getListFooter(); ?>
			</td>
		</tr>
	</tfoot>

	<tbody>
		<?php
		$k = 0;
		for ($i=0, $n=count($this->rows); $i < $n; $i++) {
			$row = $this->rows[$i];

			$link 		= 'index.php?option=com_taxibooking&amp;controller=routes&amp;task=edit&amp;cid[]='. $row->id;
			$checked 	= JHTML::_('grid.checkedout', $row, $i );
                        $published 	= JHTML::_('grid.published', $row, $i );
			
   		?>
		<tr class="<?php echo "row$k"; ?>">
			<td><?php echo $this->pageNav->getRowOffset( $i ); ?></td>
			<td width="7"><?php echo $checked; ?></td>
			<td align="left">
                            <span>
                            <a href="<?php echo $link; ?>">
                            <?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?>
                            </a></span>
				
			</td>
                        <td align="center"><?php echo $row->from; ?></td>
                        <td align="center"><?php echo $row->to; ?></td>
                        <td align="center"><?php echo $row->price; ?></td>
                        <td align="center"><?php echo $published; ?></td>
			
			<td class="order" colspan="2">
				<span><?php echo $this->pageNav->orderUpIcon( $i, true, 'orderup', 'Move Up', $this->ordering ); ?></span>

				<span><?php echo $this->pageNav->orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $this->ordering );?></span>

				<?php $disabled = $this->ordering ?  '' : '"disabled=disabled"'; ?>

				<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled; ?> class="text_area" style="text-align: center" />
			</td>
			<td align="center"><?php echo $row->id; ?></td>
		</tr>
		<?php $k = 1 - $k; } ?>
	</tbody>

	</table>
	

	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="option" value="com_taxibooking" />
	<input type="hidden" name="controller" value="routes" />
	<input type="hidden" name="view" value="routes" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>